import axios from 'axios'

async function addStudent(studentInfo) {
    const resp = await axios.post('/api/school/addStudent', studentInfo, {
        params: {
            schoolWeId: localStorage.getItem('schoolWeID')
        }
    })
        .catch((error) => {
            window.$message.error(error.response.data.message)
        })
    return resp.data
}

async function findStudent(keyword) {
    const resp = await axios.get('/api/school/findStudent', {
        params: {
            keyword: keyword,
            schoolWeId: localStorage.getItem('schoolWeID')
        }
    })
        .catch((e) => {
            window.$message.error(e.response.data.message)
        })
    return resp.data
}

export default {
    addStudent, findStudent
}